<cfcomponent>
  <!--- This is a placeholder component for coldquery.  --->
  <cfset this.errors =    createObject("Component","ColdQuery") />
  <cfset this.messages =  createObject("Component","ColdQuery") />
  <cfset this.data =      createObject("Component","ColdQuery") />

  <cffunction name="setWorkerMethod" output="false">
    <cfargument name="value" />
    <cfif IsCustomFunction(arguments.value) >
      <cfset this.workermethod=arguments.value />
    <cfelse>
      <cfthrow message="#getMetaData(this).name# - Worker method must be a custom function.">
    </cfif>
  </cffunction>

  <cffunction name="workerMethod" output="false">
    <cfthrow message="#getMetaData(this).name# - Worker method not set">
  </cffunction>
<!---
 --->

  <cffunction name="run" output="false">
    <cfset var result = "" />
    <cfset var catchdetail= "" />
    <cftry>
      <cfset result = this.workermethod(argumentcollection=arguments) />
      <cfcatch>
        <cfset this.messages = this.messages.append("There was an error in the specified method") />
        <cfset this.data = this.data.append(arguments) />
        <cfset this.workermethod= this.data.append(this.workermethod) />
        <cfset this.errors = this.errors.append(cfcatch) />
        <cfthrow message="Error running worker method in #getMetaData(this).name# #cfcatch.message#" type="jsonencodederror" detail="#serializeJson(catchdetail)#"/>
      </cfcatch>
    </cftry>
    <cfreturn result />
  </cffunction>

</cfcomponent>
